USE master
GO
CREATE DATABASE Lab06_AutoMobile
GO
USE Lab06_AutoMobile
GO
CREATE TABLE ProductDetail
(
	Model varchar(10),
	Manufacturer varchar(50),
	BuiltYear int ,
	VIN varchar(20) ,
	Cylinders int ,
	Color varchar(10) ,
	EngineNumber int ,
	Price int 
)
GO
CREATE TABLE Account
(
	username nvarchar(20),
	[password] nvarchar(20)
)
GO
INSERT INTO Account VALUES ('admin','123456')
GO
CREATE PROC sp_GetAllAccount
AS
BEGIN
	SELECT *FROM Lab06_AutoMobile.dbo.Account
END
GO

CREATE PROC sp_InsertNewAccount
@user nvarchar(20),
@pass nvarchar(20)
AS
BEGIN
	INSERT INTO Lab06_AutoMobile.dbo.Account VALUES(@user,@pass)
END
GO

CREATE PROC sp_UpdateAccount
@user nvarchar(20),
@pass nvarchar(20)
AS
BEGIN
	UPDATE Lab06_AutoMobile.dbo.Account SET [password] = @pass WHERE username =  @user
END
GO

CREATE PROC sp_DeleteAccount
@user nvarchar(20)
AS
BEGIN
	DELETE FROM Lab06_AutoMobile.dbo.Account WHERE username = @user
END
GO